package com.xintonghua.bussiness.ui.user.manage;

import android.os.Bundle;

import com.alibaba.fastjson.JSONObject;
import com.jcodecraeer.xrecyclerview.XRecyclerView;
import com.xintonghua.base.utils.RefreshUtils;
import com.xintonghua.bussiness.R;
import com.xintonghua.bussiness.adapter.PositionAdapter;
import com.xintonghua.bussiness.base.BaseActivity;
import com.xintonghua.bussiness.bean.StaffBean;
import com.xintonghua.bussiness.util.MyState;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 作者：wanxianyi
 * 时间：2018/3/29.
 * 包名：com.xintonghua.bussiness.ui.user.manage
 */

public class PositionActivity extends BaseActivity {
    @BindView(R.id.lv_position)
    XRecyclerView lvPosition;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_position);
        ButterKnife.bind(this);
        initUI();
    }

    @Override
    public void initUI() {
        super.initUI();
        onSimpleActionBar();
        setSimpleActionBar("职位选择");
        RefreshUtils.initList(this, lvPosition);
        httpCent.staffTypes(this, MyState.requestOne);
    }

    @Override
    public void dataBack(Object data, int order) {
        super.dataBack(data, order);
        switch (order) {
            case MyState.requestOne:
                List<StaffBean> list = JSONObject.parseArray((String) data, StaffBean.class);
                PositionAdapter adapter = new PositionAdapter(this, list);
                lvPosition.setAdapter(adapter);
                break;
        }
    }
}
